//计算1/1-1/2+1/3-1/4+1/5 …… + 1/99 - 1/100 的值 。

public class Test10 {
    public static void main(String[] args) {
        double total=0.0;
        double num=0.0;
        for (double i = 1.0; i <=100 ; i++) {
            if(i%2==0){
                num=(-1)*(i/i);
            }else{
                num=1/i;
            }
            total+=num;
        }
        System.out.println(total);
    }
}
